cmake_minimum_required(VERSION 3.5)
project(udp_gps_forwarder)

# Default to C99 for C and C++14 for C++
if(NOT CMAKE_C_STANDARD)
  set(CMAKE_C_STANDARD 99)
endif()
if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# Find package dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(geographic_msgs REQUIRED)
find_package(mavros_msgs REQUIRED)

# Declare an executable
add_executable(udp_gps_forwarder_node src/udp_gps_forwarder.cpp)

# Declare dependencies for the executable
ament_target_dependencies(udp_gps_forwarder_node
  rclcpp
  sensor_msgs
  geometry_msgs
  geographic_msgs
  mavros_msgs
)

# Auto-find test dependencies if building tests
if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  ament_lint_auto_find_test_dependencies()
endif()

# Install the executable
install(TARGETS udp_gps_forwarder_node
  DESTINATION lib/${PROJECT_NAME}
)

ament_package()
